<!--弹目-->
<div ng-if="pagedata.showtanmus &&  pagedata.setting.no_tanmu!=1" class="video-sms-pane {{pagedata.transition?'transition':''}}">
		<div class="video-sms-text">
			<image class="video-sms-logo" ng-src="{{pagedata.tanmus[pagedata.nowmsgid].avatar}}"/>
			<span class="overflow-h"> 最新订单来自 {{pagedata.tanmus[pagedata.nowmsgid].nickname}}</span>
		</div>
</div>
<script>
console.log(scope.pagedata.params);
scope.pagedata.gotoitem=function(item){
	if(item.pluginname=='jy_taobaoke'){
		$('#showtaobaoke').modal();
		scope.pagedata.selectgoods=item;
		scope.pagedata.copyinfo='【'+item.title+'】'+item.active.url+' 点击链接，再选择浏览器打开；或复制这段描述'+item.active.code+'后到《手机淘宝》';
		scope.$evalAsync();
	}else{
		var goodsdetail_url=scope.pagedata.goodsdetail_url?scope.pagedata.goodsdetail_url:'jy_weishop/goods.detail/';
		scope.access_json(item.active.url || goodsdetail_url+'/id='+item.id);
	}
}
scope.pagedata.issocketmsg=false;
scope.pagedata.tanmuspage=0;
scope.pagedata.isa2=true;
scope.pagedata.isno_coupontop=1;
scope.pagedata.gettanmus=function() {
	if(!scope.pagedata.issocketmsg){
			scope.pagedata.nowmsgid=0;
			scope.get('jy_weishop/get_data/gettanmus/page='+scope.pagedata.tanmuspage,function(res){
						//console.log(res);
						scope.pagedata.tanmus=res.list
						if(scope.pagedata.tanmus.length>0){
							scope.pagedata.tanmuspage++;
							scope.pagedata.up_oldtanmu();
						}
			});
	}
}
//刚进入时；如果没有新订单消息，就弹储备订单消息
if(scope.pagedata.setting.no_tanmu!=1){
		setTimeout(function(){
			scope.pagedata.gettanmus();
		},2000);
}
scope.pagedata.up_oldtanmu=function() {
		if(scope.page.action=='goods.index'){
			var i=scope.pagedata.nowmsgid;
			if(i<scope.pagedata.tanmus.length){
				set_tanmu(scope.pagedata.tanmus[i].nickname,scope.pagedata.tanmus[i].avatar,scope.pagedata.tanmus[i].time);
			}else{
				scope.pagedata.gettanmus();
			}
		}else{
			return false;
		}
}
function set_tanmu(nickname,avatar,time) {
		scope.pagedata.nowmsgid++
		scope.pagedata.showtanmus=true
		scope.$evalAsync(scope.pagedata.showtanmus);
		setTimeout(function(){
			scope.pagedata.transition=true
			scope.$evalAsync(scope.pagedata.transition);	
		},300);
		setTimeout(function(){
			scope.pagedata.showtanmus=false
			scope.pagedata.transition=false
			scope.$evalAsync(scope.pagedata.showtanmus);	
		},2000);
		setTimeout(function(){
			//等待5秒，如果没有新的订单消息，就弹储备订单消息
			scope.pagedata.issocketmsg=scope.pagedata.issocketmsg?scope.pagedata.issocketmsg:false;
			if(!scope.pagedata.issocketmsg && scope.page.action=='index'){
				scope.pagedata.up_oldtanmu();
			}
		},4000);
}
scope.pagedata.showfilter=function(){
		$('#showfilter').modal();
}
scope.pagedata.getmerchs=function(item){
	var keyword=scope.pagedata.params.keyword?scope.pagedata.params.keyword:'';
	scope.get('jy_weishop/get_data/getmerchs/limit=5&keyword='+keyword,function(res){
		scope.pagedata.merchlist=res.list
		scope.pagedata.merchsloading=false
		scope.$evalAsync();
	});
}
scope.pagedata.getlist=function(order,showtype){
	if(order){
		scope.pagedata.params.order = order;
	}
	if(scope.pagedata.params.keyword){
		scope.pagedata.getmerchs();
	}
	scope.pagedata.paramstype=showtype;
	scope.pagedata.isshowsearch=showtype;
	scope.tool.get_list('jy_weishop/goods.index/getlist/',true);
	scope.$evalAsync();
}

//手机软键盘--搜索
$("body").keydown(function() {
    if (event.keyCode == "13") {
        $('#searchsub').click();
    }
});
</script>